/**
 * Copyright 2018-2020 stylefeng & fengshuonan (sn93@qq.com)
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cn.stylefeng.guns.cloud.workflow.api;

import cn.stylefeng.guns.cloud.model.page.PageResult;
import cn.stylefeng.guns.cloud.workflow.api.entity.ActBaseEntity;
import cn.stylefeng.guns.cloud.workflow.api.model.result.ActBaseResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * 工作流远程调用接口
 *
 * @Author xuyuxiang
 * @Date 2019/11/17 22:47
 **/
@RequestMapping("/baseWorkFlow")
public interface WorkflowApi<T extends ActBaseEntity> {

    /**
     * 开启流程接口
     *
     * @Param processDefinitionKey ：流程定义key
     * @Param businessId ：业务id
     * @Param entity ：继承自ActBaseEntity的业务实体
     * @Param paramMap ：其他需要传入的参数，如无则传new HashMap<>()
     * @Author xuyuxiang
     * @Date 2019/11/17 22:50
     **/
    @RequestMapping(value = "/start", method = RequestMethod.POST)
    void start(@RequestParam("processDefinitionKey") String processDefinitionKey,
               @RequestParam("businessId") Long businessId,
               @RequestBody T entity,
               @RequestBody Map<String, Object> paramMap);

    /**
     * 驳回后修改内容重新申请
     *
     * @Param entity 修改后的业务实体
     * @Author xuyuxiang
     * @Date 2019/11/17 22:53
     **/
    @RequestMapping(value = "/reStart", method = RequestMethod.POST)
    void reStart(@RequestBody T entity);

    /**
     * 驳回后取消申请
     *
     * @Param entity 业务实体
     * @Author xuyuxiang
     * @Date 2019/11/17 22:53
     **/
    @RequestMapping(value = "/cancel", method = RequestMethod.POST)
    void cancel(@RequestBody T entity);

    /**
     * （列表）填充业务实体返回结果工作流相关字段，用于展示申请的状态信息
     *
     * @Param entityList :继承自ActBaseEntity的实体
     * @Author xuyuxiang
     * @Date 2019/11/17 22:57
     **/
    @RequestMapping(value = "/fillEntityList", method = RequestMethod.POST)
    void fillEntityList(@RequestBody List<T> entityList);

    /**
     * （列表）填充结果集工作流相关字段，用于展示申请的状态信息
     *
     * @Param resultList :继承自ActBaseResult的结果集model
     * @Author xuyuxiang
     * @Date 2019/11/17 22:57
     **/
    @RequestMapping(value = "/fillResultList", method = RequestMethod.POST)
    void fillResultList(@RequestBody List<? extends ActBaseResult> resultList);

    /**
     * （分页）填充业务实体返回结果工作流相关字段，用于展示申请的状态信息
     *
     * @Param pageResult:继承自ActBaseEntity的分页对象
     * @Author xuyuxiang
     * @Date 2019/11/17 22:57
     **/
    @RequestMapping(value = "/fillEntityPage", method = RequestMethod.POST)
    void fillEntityPage(@RequestBody PageResult<T> pageResult);

    /**
     * （分页）填充结果集工作流相关字段，用于展示申请的状态信息
     *
     * @Param pageResult:继承自ActBaseResult的分页对象
     * @Author xuyuxiang
     * @Date 2019/11/17 22:57
     **/
    @RequestMapping(value = "/fillResultPage", method = RequestMethod.POST)
    void fillResultPage(@RequestBody PageResult<? extends ActBaseResult> pageResult);
}
